package com.fau.wmbj.server.storage;

import com.fau.wmbj.server.entity.BaseEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 文件详情类
 *
 * @author jiawei
 **/
@Getter
@Setter
@Entity
@Table(name = "f_storage_directory")
public class StorageDirectory extends BaseEntity<Long> implements Serializable {

    /**
     * 文件名
     */
    @NotNull
    @Column(name = "file_name", nullable = false)
    private String fileName;

    /**
     * 文件链接
     */
    @NotNull
    @Column(name = "url_", nullable = false)
    private String url;

    /**
     * 文件系统存储组id
     */
    @Column(name = "group_id")
    private String groupId;

    /**
     * 后缀名
     */
    @NotNull
    @Column(name = "file_type", nullable = false)
    private String fileType;

    /**
     * 上传方式
     */
    @NotNull
    @Column(name = "storage_plugin", nullable = false)
    private String storagePlugin;

    /**
     * 对应表名
     */
    @Column(name = "tag_")
    private String tag;

    /**
     * 上传人
     */
    @Column(name = "user_id")
    private Long userId;

    /**
     * 预览文件
     */
    @Column(name = "preview")
    private String preview;

    /**
     * 文件大小
     */
    @Column(name = "file_size")
    private Long fileSize;

    /**
     * 文件服务器
     */
    @Column(name = "storage_server")
    private String storageServer;

    /**
     * 备注
     */
    @Column(name = "remarks")
    private String remarks;

    /**
     * 可以显示的url
     */
    @Transient
    private String displayUrl;

    @Transient
    private String base64url;
}
